<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<h2>当前计数：{{counter}}</h2>
			<!-- <button v-on:click="add">+</button>
			<button v-on:click="sub">-</button> -->
			<button @click="add">+</button>
			<button @click="sub">-</button>
		</div>
	</body>
	<script type="text/javascript">
		const app = new Vue({
			el: '#app',
			data: {
				counter: 0
			},
			methods: {
				add: function() {
					this.counter++
				},
				sub: function() {
					this.counter--
				}
			},
			beforeMount: function() {
				console.log('beforeMount');
			},
			created: function() {
				console.log('created');
			},
			mounted: function() {
				console.log('mounted');
			}
		})
	</script>
</html>
